﻿using Windows.UI.Xaml;

namespace WinRTControl.Extensions
{
    public static class DependencyObjectExtensions
    {
        public static void SetValueNoCallBack(this DependencyObject d, DependencyProperty property, object value)
        {
            DependencyObjectExtensionProperties.SetAreHandlersSuspended(d, true);
            try
            {
                d.SetValue(property, value);
            }
            finally
            {
                DependencyObjectExtensionProperties.SetAreHandlersSuspended(d, false);
            }
        }

        public static bool AreHandlersSuspended(this DependencyObject d)
        {
            return DependencyObjectExtensionProperties.GetAreHandlersSuspended(d);
        }
    }
}
